#!/bin/bash
SCRIPT_HOME=$(dirname $(readlink -f $0))
cd $SCRIPT_HOME
start(){ 
 now=`date "+%Y%m%d%H%M%S"` 
 exec
 java -Xms64m -Xmx256m -jar op-eureka-service.jar --server.port=8991 --config.name=dev --spring.config.location=classpath:/config/application.properties>logs/op-eureka-server.log &
} 

stop(){ 
 ps aux|grep op-eureka-service.jar|grep 8991 |grep -v grep|awk '{print $2}'|while read pid 
 do 
    kill -9 $pid
 done
} 
   
case "$1" in 
start) 
start 
;; 
stop) 
stop 
;;   
restart) 
stop 
start 
;; 
*) 
printf 'Usage: %s {start|stop|restart}\n' "$testg" 
exit 1 
;; 
esac
